<style>
    table.table-form-title{margin:20px auto 0;}
    table.table-form-title td{text-align: center;border-bottom:0 !important;}
    table.table{width:90%;margin:0 auto;}
    table.table-form-attach{margin-bottom:100px;}
</style>
<div style="margin:0 auto;">
    <table class="table-form-title table" style="margin-top:20px;">
        <tr>
            <td colspan="4" style="border-bottom: 0 !important;">
                <h2>${config.getKey("COMPANY_NAME")}</h2>
                <h2>${bpmTaskFrom.fromName}</h2>
            </td>
        </tr>
        <!--<tr>-->
            <!--<td width="15%"></td>-->
            <!--<td width="45%"></td>-->
            <!--<td width="15%"><span>项目档案编号：</span></td>-->
            <!--<td class="text-left">-->
                <!--<@f.input name="projectId" value="" placeholder="项目档案编号" required=true/>-->
            <!--</td>-->
        <!--</tr>-->

    </table>
    <table class="table-form-head table table-hover table-bordered">
        <tr>
            <th>发起人</th>
            <td>
                <@f.tableselect name="launchName" value="" labelValue="" boxTitle="用户信息" url="bpm/manager/list" keyId="name" keyName="name" checked=false
                tableInfo = "[{field:'username',title:'账号'},{field:'name',title:'姓名',query: true},{field:'compName',title:'归属公司'},
                {field:'deptName',title:'归属机构'},{field:'mobile',title:'手机号码'},
                {field:'status',title:'状态',dict:'sys_user_show_hide',query: true}]"  placeholder="发起人" />
                <div id="c_tableselect2222" class="panel-collapse collapse"></div>
            </td>
            <th>发起时间</th>
            <td>
                <@f.input name="createTime" type="date" dataType="date" dataFormat="yyyy-MM-dd"
                placeholder="发起日期"  butClass="fa fa-calendar-plus-o" required=true />
            </td>
        </tr>
        <tr>
            <th>项目档案编号</th>
            <td >
                <@f.tableselect checked=false keyId="name" keyName="name" url="/bpm/project/list"
                name="projectId" boxTitle="项目档案" tableInfo = "[{field:'name',title:'项目档案编号'},
                {field:'projectName',title:'项目名称'}, {field:'department',title:'项目所属部门'},{field:'ceoName',title:'项目经理'},
                {field:'contractFirst',title:'委托单位'},{field:'createTime',title:'创建时间'}]" placeholder="请选择项目档案编号" />
                <!--<@f.input name="projectDept" placeholder="请输入项目所属部门" required=true/>-->
            </td>
            <th>项目所属部门</th>
            <td >
                <@f.tableselect checked=false keyId="department" keyName="department" url="/bpm/project/list"
                name="projectDept" boxTitle="项目档案" tableInfo = "[{field:'name',title:'项目档案编号'},
                {field:'projectName',title:'项目名称'}, {field:'department',title:'项目所属部门'},{field:'ceoName',title:'项目经理'},
                {field:'contractFirst',title:'委托单位'},{field:'createTime',title:'创建时间'}]" placeholder="请选择项目档案编号" />
            </td>
        </tr>
    </table>

    <table class="table-form-body table table-hover table-bordered">
        <thead>
        <tr>
            <td colspan="9">
                <button name="btn-insert" type="button" class="btn btn-primary btn-rounded btn-sm">插入行</button>
                <button name="btn-copy" type="button" class="btn btn-primary btn-rounded btn-sm">复制行</button>
                <button name="btn-del" type="button" class="btn btn-primary btn-rounded btn-sm">删除行</button>
                <button name="btn-del-all" type="button" class="btn btn-primary btn-rounded btn-sm">删除全部</button>
                <button name="btn-import" type="button" class="btn btn-primary btn-rounded btn-sm">导入数据</button>

            </td>
        </tr>
        <tr>
            <th width="10%">序号</th>
            <th>分类</th>
            <th>项目类别</th>

        </tr>
        </thead>

        <tbody name="items">
        <tr data-id="">
            <td ><span>1 </span></td>
            <td  style="width: 30%" >
                <@f.select  name="classify" dictType="sys_bpm_classify" blankValue="" blankLabel="请选择分类"/>
            </td>
            <td>
                <@f.select  name="projectType" dictType="sys_bpm_type" blankValue="" blankLabel="请选择项目类别"/>
            </td>

        </tr>
        </tbody>
   </table>

    <table class="table-form-head table table-hover table-bordered">
        <tr>
            <th>项目名称</th>
            <td >
                <@f.tableselect checked=false keyId="projectName" keyName="projectName" url="/bpm/project/list"
                name="projectName" boxTitle="项目档案" tableInfo = "[{field:'name',title:'项目档案编号'},
                {field:'projectName',title:'项目名称'}, {field:'department',title:'项目所属部门'},{field:'ceoName',title:'项目经理'},
                {field:'contractFirst',title:'委托单位'},{field:'createTime',title:'创建时间'}]" placeholder="请选择项目档案" />
                <!--<@f.input  name="projectName" value="" placeholder="请输入项目名称" required=true/>-->
            </td>
        </tr>

        <tr>
            <th>项目经理</th>
            <td >
                <@f.tableselect name="projectAdmin" value="" labelValue="" boxTitle="用户信息" url="bpm/manager/list" keyId="name" keyName="name" checked=false
                tableInfo = "[{field:'username',title:'账号'},{field:'name',title:'姓名',query: true},{field:'compName',title:'归属公司'},
                {field:'deptName',title:'归属机构'},{field:'mobile',title:'手机号码'},
                {field:'status',title:'状态',dict:'sys_user_show_hide',query: true}]"  placeholder="项目经理" />
            </td>
            <!--<th >有无地质施工</th>-->
            <!--<td >-->
            <!--&lt;!&ndash;<@f.select name="isBided" dictType="sys_yes_no" />&ndash;&gt;-->
            <!--<@f.radio name="type" dictType="sys_yes_no"/>-->
            <!--</td>-->
        </tr>
        <tr>
            <th>前期资料</th>
            <td colspan="3">
                1、勘察任务书及平面图；2、勘察纲要；3、安全、技术交底；4、终身责任授权书等（明确项目负责人注册师）
                <br>
                <!--<input type="hidden" name="overviewName" value="" />-->
                <input type="hidden" name="overviewUrl" value="" />
                <input type="file" id="file" name="file" style="display:none;" />
                <div class="pull-left">
                    <a target="_blank" name="bidedNoticeBox" href=""></a>
                </div>
                <div class="pull-right"><a onclick="showFileDlg();" href="javascript:void(0);"><i class="fa icon-link"></i></a></div>
                <!--<@f.input  name="cooperationUnit" value="" placeholder="请输入合作单位" required=true/>-->
            </td>
        </tr>
        <tr>
            <th>现场照片</th>
            <td colspan="3">
                现场照片、岩心照片等附件上传
                <br>
                <!--<input type="hidden" name="sceneImg" value="" />-->
                <input type="hidden" name="sceneImgurl" value="" />
                <input type="file" id="file1" name="file" style="display:none;" />
                <div class="pull-left">
                    <a target="_blank" name="bidedNoticeBox1" href=""></a>
                </div>
                <div class="pull-right"><a onclick="showFileDlg1();" href="javascript:void(0);"><i class="fa icon-link"></i></a></div>
                <!--<@f.input  name="cooperationUnit" value="" placeholder="请输入合作单位" required=true/>-->
            </td>
        </tr>
        <tr>
            <th>现场数据</th>
            <td colspan="3">

                <@f.input  name="sceneData" value="" placeholder="请输入现场数据" required=true/>
            </td>
        </tr>
        <tr>
            <th>野外施工过程管理</th>
            <td colspan="3">
                工程进展情况，项目质量、工期、安全管理情况，巡查记录，中间报告或检查记录、校核单等等
                <br>
                <@f.input  name="constructionzProcess" value="" placeholder="请输入合作单位" required=true/>
            </td>
        </tr>
        <tr>
            <th>原始资料</th>
            <td colspan="3">
                原始班报表（钻探工人野外记录表）、	现场编录记录（技术人员）、中间报告或检查记录、校核单；见证报告；试验报告（土工、波速试验、抽水试验）等附件上传
                <br>
                <!--<input type="hidden" name="sources" value="" />-->
                <input type="hidden" name="sources" value="" />
                <input type="file" id="file2" name="file" style="display:none;" />
                <div class="pull-left">
                    <a target="_blank" name="bidedNoticeBox1" href=""></a>
                </div>
                <div class="pull-right"><a onclick="showFileDlg1();" href="javascript:void(0);"><i class="fa icon-link"></i></a></div>
                <!--<@f.input  name="cooperationUnit" value="" placeholder="请输入合作单位" required=true/>-->
            </td>
        </tr>
        <tr>
            <th>内业报告</th>
            <td colspan="3">
                勘察设计报告附件上传
                <br>
                <!--<input type="hidden" name="sceneImg" value="" />-->
                <input type="hidden" name="officeReport" value="" />
                <input type="file" id="file3" name="file" style="display:none;" />
                <div class="pull-left">
                    <a target="_blank" name="bidedNoticeBox1" href=""></a>
                </div>
                <div class="pull-right"><a onclick="showFileDlg1();" href="javascript:void(0);"><i class="fa icon-link"></i></a></div>
                <!--<@f.input  name="cooperationUnit" value="" placeholder="请输入合作单位" required=true/>-->
            </td>
        </tr>
        <tr>
            <th>现场定位</th>
            <td colspan="3">
                <@f.input  name="sceneLocation" value="" placeholder="请输入现场定位" required=true/>
            </td>
        </tr>



        <tr>
            <th >处理意见</th>
            <td colspan="3">
                <@f.input  name="opinion" value="" placeholder="请输入处理意见" required=true/>
            </td>
        </tr>
        <tr>
            <th >备注</th>
            <td colspan="3">
                <@f.input  name="remark" value="" placeholder="请输入备注" required=true/>
            </td>
        </tr>
        <tr>

    </tr>


    </table>

</div>
<script type="text/javascript">
    function showFileDlg() {
        $("#file").click();
    }
    $("#file").change(function () {
        uploadBidedNotice();
    });
    function uploadBidedNotice() {
        var oFiles = document.getElementById("file").files;
        console.log(oFiles);
        var formdata = new FormData();
        formdata.append("file", oFiles[0]);
        opt.common.sendAjax({
            url: prefix + "/uploadFile",
            data: formdata,
            type: "POST",
            processData: false,
            contentType: false,
            success: function(result) {
                console.log(result);
                $("input[name=overviewName]").val(oFiles[0].name);
                $("input[name=overviewUrl]").val(baseURL + result.msg);
                $("a[name=bidedNoticeBox]").html(oFiles[0].name).attr("href",baseURL + result.msg);
                console.log("----------------------");
            }
        })
    }

    function showFileDlg1() {
        $("#file").click();
    }
    $("#file").change(function () {
        uploadBidedNotice1();
    });
    function uploadBidedNotice1() {
        var oFiles = document.getElementById("file").files;
        console.log(oFiles);
        var formdata = new FormData();
        formdata.append("file", oFiles[0]);
        opt.common.sendAjax({
            url: prefix + "/uploadFile",
            data: formdata,
            type: "POST",
            processData: false,
            contentType: false,
            success: function(result) {
                console.log(result);
                $("input[name=sceneImg]").val(oFiles[0].name);
                $("input[name=sceneImgurl]").val(baseURL + result.msg);
                $("a[name=bidedNoticeBox1]").html(oFiles[0].name).attr("href",baseURL + result.msg);
                console.log("----------------------");
            }
        })
    }








    function tableCallback(id, event, index, layero, nodes){
        console.log("aaaaaaaaaaaaaaa")
        if(id == "launchName"){
            console.log("弹出表格选择===>>>>: id:" + id + "  event:" + event + " index:" + index + "  layero:"+ layero + " nodes:" + JSON.stringify(nodes));
            console.log(nodes.table[0]);
            var data = nodes.table[0];
            console.log(data)

            console.log(data.ceoName);
            $("input[name=launchDepartment]").val(data.compName);
           //  $("input[name=projectName]").val(data.projectName);
           // // $("input[name=ceoName]").val(data.ceoName);
           //  $("input[name=projectAdmin]").val(data.ceoName);
           //  $("input[name=clientCompany]").val(data.contractFirst);
           //  $("input[name=projectDept]").val(data.department);
        }
    }


    $("button[name=btn-insert]").click(function () {
        var target = $(this).closest("table").find("tbody");
        var index = target.children().length + 1;
        var tpl = $(target.children().get(0)).prop("outerHTML");
        tpl = tpl.replaceAll("1", index);
        target.append(tpl);
    });
    $("button[name=btn-del]").click(function () {
        var target = $(this).closest("table").find("tbody");
        var index = target.children().length - 1;
        if(index>0){
            target.children().get(index).remove();
        }
    });
    $("button[name=btn-del-all]").click(function () {
        var target = $(this).closest("table").find("tbody");
        var index = target.children().length - 1;
        for(var i=index; i>0; i--){
            target.children().get(i).remove();
        }
    });
</script>